<?php

/*

User Market (user_market.php)

*/

$rank_check = 1;
$page_title = "User Market";
include "header.inc.php";

echo $openHTML;

if (!$start) { $start = 0; }

$findShops = mysql_query("SELECT owner,shop_name,shop_size,shop_desc FROM usershops2 WHERE game = '$game' ORDER BY shop_size DESC LIMIT $start,10");
$numShops = fetch("SELECT count(id) AS id FROM usershops2 WHERE game = '$game'");
while ($getShops = mysql_fetch_array($findShops))
{
	$findOwner = fetch("SELECT username,display_name FROM members2 WHERE id = '$getShops[owner]'");
	$getShops[shop_desc] = strip_tags(substr("$getShops[shop_desc]", 0, 512), "<b><i><u><a>");
	$getShops[shop_desc] .= "...";

	print "<p align=center><table cellspacing=1 cellpadding=0 bgcolor=\"$tableOutline\" width=95%><tr bgcolor=#FFFFFF width=100%><td><p><b><a href=usershop.php?user=$findOwner[username]&game=$game>$getShops[shop_name]</a></b> <i>owned by <a href=user_profile.php?user=$findOwner[username]&game=$game>$findOwner[display_name]</a> size $getShops[shop_size]</i><br><font size=-1>$getShops[shop_desc]</font></p></td></tr></table></p>";
}


print "<p align=center>";

if ($start - 10 > 0)
{
	$prev10 = $start-10;
	print "<a href=user_market.php?game=$game&start=$prev10>Previous 10 Shops</a> ";
}

if ($numShops[id] >= $start + 10)
{
	$next10 = $start+10;
	print " <a href=user_market.php?game=$game&start=$next10>Next 10 Shops</a>";
}

print "</p>";

echo $closeHTML;

?>